package com.tianji.learning.controller;

import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @Description learningRecordsController
 * @Author apeng
 * @Date 2024-12-08
 */
@RestController
@RequestMapping("/learning-records")
@Api(tags = "学习记录")
@Slf4j
@RequiredArgsConstructor
public class LearningRecordsController {

    private final ILearningRecordService learningRecordService;

    @GetMapping("/course/{courseId}")
    @ApiOperation("查询学习记录")
    public LearningLessonDTO queryLearningRecordByCourse(@PathVariable("courseId") Long courseId) {
        return learningRecordService.queryLearningRecordByCourse(courseId);
    }


    @PostMapping
    @ApiOperation("提交学习记录")
    public void submitLearingRecord(@RequestBody LearningRecordFormDTO dto){
        learningRecordService.submitLearingRecord(dto);
    }


}
